
package Starter;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JRootPane;


import Connector.Connector;

public class MainFrame extends JFrame {
	
	private Menu mainMenu = null;
	private LoginPane loginPane = null;
	private Connector connector = null;
	private BroadcastListener broadcastListener = null;
	
	public MainFrame(Connector connector) {
	
		this.loginPane = new LoginPane(connector, this);
		this.setResizable(false);
		this.setVisible(true);
		this.setSize(342, 350);
		this.connector = connector;
		this.add(this.loginPane, BorderLayout.CENTER);
		this.broadcastListener = new BroadcastListener(this.connector.getBroadCastIn());
		
		
	}
	
	/**
	 * Pozwala na ustawienie panelu menu dla okna głównego.
	 * @param mainMenu panel menu
	 */
	public void setMainMenu(Menu mainMenu) {
		this.mainMenu = mainMenu;
	}
	
	/**
	 * Zwraca panel menu.
	 * @return panel menu.
	 */
	public Menu getMainMenu() {
		return mainMenu;
	}
	
	/**
	 * Zwraca panel logowania.
	 * @return panel logowania
	 */
	public LoginPane getLoginPane() {
		return loginPane;
	}
	
	/**
	 * Metoda zwraca obiekt łącza.
	 * @return obiekt łącza. 
	 */
	public Connector getConnector(){
		return connector;
	}
	
	/**
	 * Metoda zwraca referencję do obiektu.
	 *@return BroadCastListener object 
	 */
	public BroadcastListener getBroadcastListener() {
		return broadcastListener;
	}
}
